<?php /* Smarty version Smarty-3.0.7, created on 2017-05-31 15:45:20
         compiled from "C:\wamp\www\gongzhonghao.yuanfenba.net/modules/admin/tpl/picwx/add.tpl" */ ?>
<?php /*%%SmartyHeaderCode:2836592e749012f615-30817966%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    'a98715478ebda3fb4074b8a49e0330ee37a2e3b8' => 
    array (
      0 => 'C:\\wamp\\www\\gongzhonghao.yuanfenba.net/modules/admin/tpl/picwx/add.tpl',
      1 => 1496215166,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '2836592e749012f615-30817966',
  'function' => 
  array (
  ),
  'has_nocache_code' => false,
)); /*/%%SmartyHeaderCode%%*/?>
<?php $_template = new Smarty_Internal_Template('header.tpl', $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
 echo $_template->getRenderedTemplate();?><?php unset($_template);?>
<style>
    td {
        padding: 16px;
    }

    tr {
        line-height: 24px;
    }
</style>
<?php $_smarty_tpl->tpl_vars['config_info'] = new Smarty_variable(FConfig::get('info_config'), null, null);?>
<form name="form" method="post" action="/admin/PicWx/add" enctype="multipart/form-data">
    <input type="hidden" name="id" value="<?php echo $_smarty_tpl->getVariable('data')->value['id'];?>
">
    <table>
        <tr>
            <td>
                <table class="tmain g_w">
                    <tr>
                        <td colspan="8" style="background-color: #cccccc; ">服务号关注推送消息</td>
                    </tr>


                    <tr>
                        <th style="width: 200px;">公众号选择：</th>
                        <td>
                            <select id="gzh_id" name="gzh_id" onblur="articleData()">
                                <option <?php if ($_smarty_tpl->getVariable('data')->value['wid']==0){?>selected<?php }?> value="0">请选择对应的公众号</option>
                                <?php  $_smarty_tpl->tpl_vars['v'] = new Smarty_Variable;
 $_smarty_tpl->tpl_vars['k'] = new Smarty_Variable;
 $_from = Service_Gzh::gzh(); if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
if ($_smarty_tpl->_count($_from) > 0){
    foreach ($_from as $_smarty_tpl->tpl_vars['v']->key => $_smarty_tpl->tpl_vars['v']->value){
 $_smarty_tpl->tpl_vars['k']->value = $_smarty_tpl->tpl_vars['v']->key;
?>
                                    <option  <?php if ($_smarty_tpl->getVariable('data')->value['wid']==$_smarty_tpl->tpl_vars['v']->value['wid']){?>selected<?php }?> value="<?php echo $_smarty_tpl->tpl_vars['v']->value['wid'];?>
"><?php echo $_smarty_tpl->tpl_vars['v']->value['wid'];?>
-<?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['v']->value['name'];?>
<?php $_tmp1=ob_GET_clean();?><?php echo $_tmp1;?>
</option>
                                <?php }} ?>
                            </select>
                        </td>
                    </tr>

                    <tr>
                        <th style="width: 200px;">推送的文章选择：</th>
                        <td>
                            <select name="article_id" id="article_id">
                                <option selected value="0">请选择推送文章</option>
                                <?php  $_smarty_tpl->tpl_vars['v'] = new Smarty_Variable;
 $_smarty_tpl->tpl_vars['k'] = new Smarty_Variable;
 $_from = Service_Gzh::articleList($_smarty_tpl->getVariable('data')->value['wid']); if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
if ($_smarty_tpl->_count($_from) > 0){
    foreach ($_from as $_smarty_tpl->tpl_vars['v']->key => $_smarty_tpl->tpl_vars['v']->value){
 $_smarty_tpl->tpl_vars['k']->value = $_smarty_tpl->tpl_vars['v']->key;
?>
                                    <option  <?php if ($_smarty_tpl->getVariable('data')->value['article_id']==$_smarty_tpl->tpl_vars['v']->value['id']){?>selected<?php }?> value="<?php echo $_smarty_tpl->tpl_vars['v']->value['id'];?>
"><?php echo $_smarty_tpl->tpl_vars['v']->value['id'];?>
-<?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['v']->value['title'];?>
<?php $_tmp2=ob_GET_clean();?><?php echo $_tmp2;?>
</option>
                                <?php }} ?>
                            </select>
                        </td>



                    </tr>




                    <tr>
                        <td colspan="8" align=center>
                            <button type="submit" class="btn btn-primary">提交</button>
                        </td>
                    </tr>


                </table>
            </td>
        </tr>

    </table>
</form>
<script type="text/javascript" language="JavaScript">

    function articleData(){
        var wid= $('#gzh_id').val();
        $.ajax({
            type: 'post',
            url: '/admin/PicWx/gzhActicle',
            dataType: "json",
            async: false,
            data: {
                wid: wid
            },
            success: function (data) {
                $("#article_id").empty();
                if(data.status == 200){
                    var count = data.data.length;
                    var b="<option selected='selected' value='' >请选择推送文章</option>";
                    for(i=0;i<count;i++){
                        b+="<option value='" + data.data[i]["id"] + "'>" + data.data[i]["title"] + "</option>";
                    }
                    $("#article_id").append(b);
                }else {
                    var b="<option selected='selected' value='' >请选择推送文章</option>";
                    $("#article_id").append(b);
                }

            },
            error: function () {
                alert('编辑错误！');
            }
        })

    }




</script>

<?php $_template = new Smarty_Internal_Template('footer.tpl', $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
 echo $_template->getRenderedTemplate();?><?php unset($_template);?>
